<?php 
defined('RUN_KATANA') or die('Restricted access');
echo $commander->getListCommandsPanel('sa', ''); 
if(is_object($adc->getCurrentAdCat())):
$forms = $fc->getForms();
?>
<fieldset class="edit_form">
	<label for="Title"><?php echo ucfirst($txt->getWord('title')); ?></label>
    <?php echo $commander->getErrorField('Title'); ?>
    <?php echo $commander->getInfoField('Title'); ?>
    <input name="Title" class="medium" type="text" value="<?php echo $adc->CurrentAdCat->getTitle(); ?>" maxlength="80" />
	
	<label for="TitleEn"><?php echo ucfirst($txt->getWord('Title')); ?> (En)</label>
    <?php echo $commander->getErrorField('TitleEn'); ?>
    <?php echo $commander->getInfoField('TitleEn'); ?>
    <input name="TitleEn" class="medium" type="text" value="<?php echo $adc->CurrentAdCat->getTitleEn(); ?>" maxlength="80" />
	
	<label for="TypeId"><?php echo ucfirst($txt->getWord('ad_type')); ?></label>
    <?php echo $commander->getErrorField('TypeId'); ?>
    <?php echo $commander->getInfoField('TypeId'); ?>
    <select class="medium" name="TypeId" onchange="submit();">
        <option value="--" <?php echo getIsSelectedHTML($adc->CurrentAdCat->getTypeId(), '--'); ?>><?php echo ucfirst($txt->getWord('undefined')); ?></option>
        <?php 
        if($adc->getAdTypes())
        {
            foreach($adc->getAdTypes() as $type)
            { echo '<option value="'.$type->getId().'" '.getIsSelectedHTML($adc->CurrentAdCat->getTypeId(), $type->getId()).'>'.$type->getTitle().'</option>'; }
        }
        ?>
    </select>
	
	<label for="ParentId"><?php echo ucfirst($txt->getWord('parent').' '.$txt->getWord('ad_category')); ?></label>
    <?php echo $commander->getErrorField('ParentId'); ?>
    <?php echo $commander->getInfoField('ParentId'); ?>
    <select class="medium" name="ParentId" onchange="submit();">
        <option value="--" <?php echo getIsSelectedHTML($adc->CurrentAdCat->getParentId(), '--'); ?>><?php echo ucfirst($txt->getWord('none')); ?></option>
        <?php 
        if($adc->getAdCats())
		{
			foreach($adc->getAdCats() as $adcat)
			{ 
				if($adcat->getId() != $adc->CurrentAdCat->getId())
				{
					if($adc->CurrentAdCat->getTypeId() > 0)
					{
						if($adc->CurrentAdCat->getTypeId() == $adcat->getTypeId())
						{ echo '<option value="'.$adcat->getId().'" '.$txt->getIsSelectedHTML($adc->CurrentAdCat->getParentId(), $adcat->getId()) .'>'.$adcat->getTitle().'</option>'; }
					}
					else
					{ echo '<option value="'.$adcat->getId().'" '.$txt->getIsSelectedHTML($adc->CurrentAdCat->getParentId(), $adcat->getId()) .'>'.$adcat->getTitle().'</option>'; }
				}
			}
		}
        ?>
    </select>
	
    <label for="FormId"><?php echo ucfirst($txt->getWord('selling').' '.$txt->getWord('form')); ?></label>
    <?php echo $commander->getErrorField('FormId'); ?>
    <?php echo $commander->getInfoField('FormId'); ?>
    <select class="medium" name="FormId" onchange="submit();">
        <option value="--" <?php echo getIsSelectedHTML($adc->CurrentAdCat->getCountry(), '--'); ?>><?php echo ucfirst($txt->getWord('ad_type').' '.$txt->getWord('defined')); ?></option>
        <?php 
        if($forms)
        {
            foreach($forms as $form)
            { echo '<option value="'.$form->getId().'" '.getIsSelectedHTML($adc->CurrentAdCat->getFormId(), $form->getId()).'>'.$form->getTitle().'</option>'; }
        }
        ?>
    </select>
	
	<label for="FormBuyId"><?php echo ucfirst($txt->getWord('buying').' '.$txt->getWord('form')); ?></label>
    <?php echo $commander->getErrorField('FormId'); ?>
    <?php echo $commander->getInfoField('FormId'); ?>
    <select class="medium" name="FormId" onchange="submit();">
        <option value="--" <?php echo getIsSelectedHTML($adc->CurrentAdCat->getCountry(), '--'); ?>><?php echo ucfirst($txt->getWord('ad_type').' '.$txt->getWord('defined')); ?></option>
        <?php
        if($forms)
        {
            foreach($forms as $form)
            { echo '<option value="'.$form->getId().'" '.getIsSelectedHTML($adc->CurrentAdCat->getFormId(), $form->getId()).'>'.$form->getTitle().'</option>'; }
        }
        ?>
    </select>
	<label for="Image"><?php echo ucfirst($txt->getWord('image')); ?></label>
	<?php echo $commander->getErrorField('Image'); ?>
    <?php echo $commander->getInfoField('Image'); ?>
	
	<?php if($adc->CurrentAdCat->getImage() != ''):  ?>
	<img src="<?php echo $adc->CurrentAdCat->getImageURL(); ?>" />&nbsp;&nbsp;
	<a onmousedown="jQuery('#ImageDelete').val(1);" onmouseup="jQuery('#edit_form').submit();"><img title="<?php echo ucfirst($txt->getWord('delete').' '.$txt->getWord('image')); ?>" class="icon command" src="<?php echo SYSICONS_URL; ?>delete_16.gif" /></a><br />
	<input type="hidden" id="ImageDelete" name="ImageDelete" value="0" /><br />
	<?php else:  ?>
    <input name="Image" class="medium" type="file" /><br />
	<?php endif;  ?>
    <label for="Description"><?php echo ucfirst($txt->getWord('description')); ?></label>
    <?php echo $commander->getErrorField('Description'); ?>
    <?php echo $commander->getInfoField('Description'); ?>
    <textarea name="Description" class="medium limit_500 autogrow"><?php echo $adc->CurrentAdCat->getDescription(); ?></textarea>
</fieldset>
<?php endif; ?>